<template>
	<view class="richBox">
		<rich-text :nodes="content"></rich-text>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				content:''
			}
		},
		onLoad(option) {
			this.getDetail(option.id)
		},
		methods: {
			async getDetail(id){
				const dId = Number(id)
				let res = await this.$api.post('Content/Detail',{ID:dId})
				if (res?.code == 0) {
					uni.setNavigationBarTitle({
						title: res.data?.Title
					});
					this.content=res.data.Content.replaceAll(/\<img/gi, '<img style="width:100%;height:auto"')
				}else{
					this.$pv.msg(res?.message)
				}
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	img{
		width: 100%;
		height: 100%;
	}
	.richBox{
		padding: 20rpx 40rpx 80rpx;
		word-wrap: break-word;
		rich-text{
			width: 100%;
		}
	}

</style>
